(define (hasCircle? lst) 
   (define (safe-cdr l) 
     (if (pair? l) 
         (cdr l) 
         '())) 
   (define (iter slow fast) 
     (cond ((not (pair? slow)) #f) 
           ((not (pair? fast)) #f) 
           ((eq? slow fast) #t)
           (else (iter (safe-cdr slow) (safe-cdr (safe-cdr fast)))))) 
   (iter (safe-cdr lst) (safe-cdr (safe-cdr lst))))
